package com.neusoft.Shixun.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neusoft.Shixun.dto.RoomDto;
import com.neusoft.Shixun.po.Bed;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BedDao extends BaseMapper<Bed> {
    // 在这里可以定义一些自定义的SQL操作（如果有需要）

//    查询所有楼层的房间号，去重
    @Select("SELECT DISTINCT SUBSTRING(room_number, 1, 1) AS floor, room_number " +
            "FROM beds " +
            "ORDER BY floor, room_number")
    List<RoomDto> getAllRoomsByFloor();
}